/*
 * 配置文件
 * 
 */
'use strict'

var path = require('path');
var util = require('./libs/util');
var Wechat = require('./wechat/wechat');
var wechat_file = path.join(__dirname,'./config/wechat.txt');
var wechat_ticket = path.join(__dirname,'./config/wechat_ticket.txt');

var config = {
	wechat:{
		appID:'wxc8499c0200d65192',
		appSecret:'772260dd2d4c534a62d53eedae6a8c3d',
		token:'cyymfyyoyo',
		getAccessToken:function(){
			return util.readFileAsync(wechat_file);
		},
		saveAccessToken:function(data){
			return util.writeFileAsync(wechat_file,data);
		},
		getTicket:function(){
			return util.readFileAsync(wechat_ticket);
		},
		saveTicket:function(data){
			return util.writeFileAsync(wechat_ticket,data);
		},
	}
};

exports.getWechat = function(){
	var wechatApi = new Wechat(config.wechat)
	return wechatApi
}

exports.configOption = config